const fs = require('fs')

function readFilePromise(fileName){
    return new Promise((resolve, reject) => {
        fs.readFile(fileName, 'utf-8', (err, data) => {
            if(err){
                reject(err.message)
            }
            resolve(data)
        })
    })
}

readFilePromise('./1.txt')
.then((data) => {
    console.log(data);
    return readFilePromise('./2.txt')
}).then((data) => {
    console.log(data);
    return readFilePromise('./3.txt')
}).then((data)=>{
    console.log(data);
    
})